package com.zty.xiaomi.server.Mapper;

import com.zty.xiaomi.server.Entity.Good;
import com.zty.xiaomi.server.Entity.GoodInfo;
import com.zty.xiaomi.server.Entity.index.GoodCategory;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface Goods {
    @Select("select name,price,oldPrice,description,sellcount,rating,info,icon,image from goods where category_id = #{category_id}")
    List<Good> getGood(int category_id);
    @Select("select name,type from category where category_id = #{category_id}")
    GoodCategory getGoodCategory(int category_id);
    @Select("select good_id,category_id,name,price,oldPrice,sellcount,icon,image,subtitle,desc1,desc2,p1,p2,store_id from goods where good_id = #{good_id} and status = 1")
    GoodInfo getGoodInfo(int good_id);


    @Select("select store_id from goods where good_id = #{good_id}")
    int getStoreIdByGoodId(int good_id);

//    @Select("select good_id from goods where store_id = 0")
//    List<Integer> getDate();
//
//    @Update("update goods set store_id = #{store_id} where good_id = #{good_id} ")
//    int updateDate(int store_id, int good_id);

}
